Returns or sets an olFlagIcon constant indicating one or none of the six flag types in Microsoft Office Outlook 2003 for e-mail messages. Read/write.
object.FlagIcon
object Required. An expression that returns one of the objects in the Applies To list.
olFlagIcon can be one of the following constants:
Setting the FlagIcon property before sending an item will not set the flag on the item when the recipient receives it.
The following Microsoft Visual Basic for Applications (VBA) example loops all items in a folder named Test in the Inbox and sets the yellow flag on items sent by Dan Wilson. To run this example without errors, make sure the Test folder exists in the default Inbox folder and replace 'Dan Wilson' with a valid sender name in the Test folder.
Sub SetFlagIcon()
Dim myOlApp As Outlook.Application
Dim mpfInbox As Outlook.MAPIFolder
Dim obj As Outlook.MailItem
Dim i As Integer
Set myOlApp = CreateObject("Outlook.Application")
Set mpfInbox = myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Folders("Test")
' Loop all items in the Inbox\Test Folder
For i = 1 To mpfInbox.Items.count
If mpfInbox.Items(i).Class = olMail Then
Set obj = mpfInbox.Items.Item(i)
If obj.SenderName = "Dan Wilson" Then
'Set the yellow flag icon
obj.FlagIcon = olYellowFlagIcon
obj.Save
End If
End If
Next
End Sub